//
//  YQProjectMiddleView.m
//  NewRetail
//
//  Created by yuqin on 2019/6/24.
//  Copyright © 2019 yuqin. All rights reserved.
//

#import "YQProjectMiddleView.h"

@interface YQProjectMiddleView ()

@property (nonatomic, strong) UIView *lineView;
//@property (nonatomic, strong) UILabel *describeLab;

@end

@implementation YQProjectMiddleView

#pragma mark - layout
- (void)setupContentView {
    self.backgroundColor = WhiteColor;
    [self addSubview:self.walletAddressBtn];
    [self addSubview:self.theTitleLab];
    [self addSubview:self.incubatorTF];
    [self addSubview:self.lineView];
    [self addSubview:self.assetsLab];
    
    
    [self.walletAddressBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-kMargin_right);
        make.top.mas_equalTo(FIT(20));
        make.size.mas_equalTo(CGSizeMake(FIT(140), FIT(35)));
    }];
    
    [self.theTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMargin_left);
        make.centerY.equalTo(self.walletAddressBtn.mas_centerY);
    }];
    
    [self.incubatorTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(FIT(22));
        make.top.equalTo(self.walletAddressBtn.mas_bottom).mas_equalTo(FIT(25));
        make.size.mas_equalTo(CGSizeMake(ScreenWidth-FIT(44), FIT(50)));
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMargin_left);
        make.top.equalTo(self.incubatorTF.mas_bottom).mas_equalTo(FIT(20));
        make.size.mas_equalTo(CGSizeMake(ScreenWidth-FIT(32), 1));
    }];
    
    [self.assetsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lineView.mas_bottom).mas_equalTo(0);
        make.left.mas_equalTo(kMargin_left);
        make.size.mas_equalTo(CGSizeMake(ScreenWidth-FIT(32), FIT(30)));
    }];
}

- (UILabel *)theTitleLab {
    if (!_theTitleLab) {
        _theTitleLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentLeft fontSize:kTheTitleFont userBold:NO];
        _theTitleLab.text = @"孵化数量(WDC)";
    }
    return _theTitleLab;
}

- (UIButton *)walletAddressBtn {
    if (!_walletAddressBtn) {
        _walletAddressBtn = [YQViewFactory buttonWithTitle:@"选择钱包地址" titleColor:WhiteColor fontSize:kNormalButtonFont userBold:YES target:self sel:@selector(chooseWalletAddress)];
        _walletAddressBtn.backgroundColor = MainBlueColor;
        _walletAddressBtn.layer.cornerRadius = 5;
    }
    return _walletAddressBtn;
}

- (UITextField *)incubatorTF {
    if (!_incubatorTF) {
        _incubatorTF = [YQViewFactory textFieldWithPlaceholderText:@"需要孵化的数量" textColor:MainBlackColor fontSize:FIT(22) userBold:YES];
        _incubatorTF.borderStyle = UITextBorderStyleNone;
    }
    return _incubatorTF;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = LineColor;
    }
    return _lineView;
}

- (UILabel *)assetsLab {
    if (!_assetsLab) {
        _assetsLab = [YQViewFactory labelWithTextColor:[UIColor lightGrayColor] textAlignment:NSTextAlignmentLeft fontSize:kTheTitleFont userBold:NO];
        _assetsLab.text = @"孵化资产：0.1709";
    }
    return _assetsLab;
}

#pragma mark - 选择钱包地址
- (void)chooseWalletAddress {
    if (self.SelectWalletAddressBlock) {
        self.SelectWalletAddressBlock();
    }
}

@end
